package com.muyu.danmo.service.impl;


import com.muyu.common.core.domain.Result;
import com.muyu.danmo.mapper.DanmoOrderItemMapper;
import com.muyu.danmo.service.IDanmoOrderItemService;
import com.muyu.system.domain.DanmoOrderItem;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.List;

/**
 * 订单项信息Service业务层处理
 * 
 * @author yangle
 * @date 2025-01-23
 */
@Service
public class DanmoOrderItemServiceImpl implements IDanmoOrderItemService
{
    @Autowired
    private DanmoOrderItemMapper danmoOrderItemMapper;

    /**
     * 查询订单项信息
     * 
     * @param id 订单项信息主键
     * @return 订单项信息
     */
    @Override
    public DanmoOrderItem selectDanmoOrderItemById(Long id)
    {
        return danmoOrderItemMapper.selectDanmoOrderItemById(id);
    }

    /**
     * 查询订单项信息列表
     * 
     * @param danmoOrderItem 订单项信息
     * @return 订单项信息
     */
    @Override
    public List<DanmoOrderItem> selectDanmoOrderItemList(DanmoOrderItem danmoOrderItem)
    {
        return danmoOrderItemMapper.selectDanmoOrderItemList(danmoOrderItem);
    }

    /**
     * 新增订单项信息
     *
     * @param danmoOrderItem 订单项信息
     * @return 结果
     */
    @Override
    public Result insertDanmoOrderItem(DanmoOrderItem danmoOrderItem)
    {
        int i = danmoOrderItemMapper.insertDanmoOrderItem(danmoOrderItem);
        return Result.success(i, "新增成功");
    }

    /**
     * 修改订单项信息
     *
     * @param danmoOrderItem 订单项信息
     * @return 结果
     */
    @Override
    public Result updateDanmoOrderItem(DanmoOrderItem danmoOrderItem)
    {
        int i = danmoOrderItemMapper.updateDanmoOrderItem(danmoOrderItem);
        return Result.success(i, "修改成功");
    }

    /**
     * 批量删除订单项信息
     *
     * @param ids 需要删除的订单项信息主键
     * @return 结果
     */
    @Override
    public Result deleteDanmoOrderItemByIds(Long[] ids)
    {
         danmoOrderItemMapper.deleteDanmoOrderItemByIds(ids);
        return Result.success(ids, "删除成功");
    }

    /**
     * 删除订单项信息信息
     *
     * @param id 订单项信息主键
     * @return 结果
     */
    @Override
    public Result  deleteDanmoOrderItemById(Long id)
    {
         danmoOrderItemMapper.deleteDanmoOrderItemById(id);
        return Result.success(id, "删除成功");

    }
}
